<template>
  <div class="f-tag-list" :style="{left:$store.state.asideWidth}">

    <el-tabs v-model="activeTab" type="card" class="flex-1"  
    @tab-remove="removeTab" style="min-width: 100px;"
    @tab-change="changeTab">
      <el-tab-pane :closable="item.path != '/' "  v-for="item in tabList" :key="item.path" :label="item.title" :name="item.path"></el-tab-pane>
    </el-tabs>

    <span class="tag-btn">
      <el-dropdown @command="handleClose" >
        <span class="el-dropdown-link">
          <el-icon>
            <arrow-down />
          </el-icon>
        </span>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item command="clearOther">关闭其他</el-dropdown-item>
            <el-dropdown-item command="clearAll">全部关闭</el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>
    </span>
  </div>
  <div style="height: 44px;"></div>
</template>

<script setup>
import { useTabList} from "@/composables/useTabList"
const{
    activeTab,
    tabList,
    changeTab,
    removeTab,
    handleClose} = useTabList()
</script>

<style scoped>
.f-tag-list{
  @apply fixed bg-gray-100 flex items-center px-2;
  top: 64px;
  right:0px;
  height: 44px;
}

.tag-btn{
  @apply bg-white rounded ml-auto flex items-center justify-center px-2;
   height: 32px;
}
/* 加:deep是因为scoped的存在--确保样式能够影响到被包裹在子组件中的元素，而不仅仅是当前组件的根元素*/
:deep(.el-tabs__header){
  border: 0!important;
  @apply mb-0;
}
/* !important--强制提升特定样式优先级--强制覆盖 Element UI 选项卡组件的默认边框样式 */
:deep(.el-tabs__nav){
  border: 0!important;
}
:deep(.el-tabs__item){
  border: 0!important;
  height: 32px;
  line-height: 32px;
  @apply bg-white mx-1 rounded;
}
:deep(.el-tabs__nav-next),:deep(.el-tabs__nav-prev){
  line-height: 32px;
  height: 32px;
}
/* 用于判断哪一个图标可以点，哪一个不可以点 */
:deep(.is-disabled){
  cursor: not-allowed;
  @apply text-gray-100;
}
</style>